package org.destinyshine.cricket.deploy;

import org.destinyshine.cricket.jaxbmodel.WebAppElement;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import java.io.InputStream;

/**
 * Created by destinyliu on 2016/2/27.
 */
public class WebXMLParser {

    public static WebAppElement parse(InputStream is) throws JAXBException {
        JAXBContext jaxbContext = JAXBContext.newInstance(WebAppElement.class);
        Unmarshaller marshaller = jaxbContext.createUnmarshaller();
        Object webapp = marshaller.unmarshal(is);

        return (WebAppElement) webapp;
    }
}
